<?php
    include_once "../../inc/config.inc.php";
    include_once '../../inc/mysql.inc.php';
    $template["title"] = "父版块列表页";
    $template["keyword"] = "父版块列表页";
    $template["description"] = "父版块列表页";
    $link = connect();
?>

<?php include_once "../inc/header.inc.php";?>
    <!-- 右侧界面开始 -->
    <div id="main">
        <div class="title">父版块列表</div>

        <table class="list">
            <tr>
                <th>排序</th>
                <th>版块名称</th>
                <th>操作</th>
            </tr>
            <?php
                $query = "select * from kuse_father_module";
                $result = execute($link, $query);

                while($data = mysqli_fetch_assoc($result)){
                    // 确定要删除后跳转到删除页
                    $del_url = urlencode("father_module_del.php?id={$data["id"]}");
                    // 记录当前页的url
                    $return_url = urlencode($_SERVER['REQUEST_URI']);
                    // 要删除的版块名
                    $message = "嗯哼！你真的要删除父版块：{$data['module_name']} 吗？";
                    // 中转页，携带上面两个url和要删除的版块名到中转页中，用户选择确定或者取消删除
                    $confirm_url = "confirm.php?del_url={$del_url}&return_url={$return_url}&message={$message}";
$html = <<<START
    <tr>
        <td><input class="sort" value="{$data["sort"]}" type='text' name="sort"></td>
        <td>{$data["module_name"]}[id:{$data["id"]}]</td>
        <td><a href="#">[访问]</a>&nbsp;&nbsp;<a href="father_module_update.php?id={$data["id"]}">[编辑]</a>&nbsp;&nbsp;<a href="{$confirm_url}">[删除]</a></td>
    </tr>
START;
                    echo $html;
                }
                
            ?>

        </table>
    </div>
    <!-- 右侧界面结束 -->

<?php include_once "../inc/footer.inc.php";?>